/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.uch.syscom.utils;

import java.util.List;
import pe.edu.uch.syscom.commonService.ServiceFinder;
import pe.edu.uch.syscom.hibernateSpringDao.*;
import pe.edu.uch.syscom.managedbeans.uibeans.UIReporteBean;

/**
 *
 * @author Jose Tejada
 */
public class CommonDAO {

    private static HSCatalogoDAO tbCatalogoDAO;
    private static HSCategoriaDAO tbCategoriaDAO;
    private static HSClienteDAO tbClienteDAO;
    private static HSDistritoDAO tbDistritoDAO;
    private static HSEmpleadoDAO tbEmpleadoDAO;
    private static HSMarcaDAO tbMarcaDAO;
    private static HSMenuDAO tbMenuDAO;
    private static HSOfertaComboDAO tbOfertaComboDAO;
    private static HSOfertaDescuentoDAO tbOfertaDescuentoDAO;
    private static HSProductoDAO tbProductoDAO;
    private static HSProveedorDAO tbProveedorDAO;
    private static HSReporteDAO tbReporteDAO;
    private static HSRolDAO tbRolDAO;
    private static HSUsuarioDAO tbUsuarioDAO;
    private static HSVentaDAO tbVentaDAO;

    public static HSCatalogoDAO getTbCatalogoDAO() {
        if ( tbCatalogoDAO == null ) {
            try {
                tbCatalogoDAO = (HSCatalogoDAO) ServiceFinder.findBean( ConstantesWeb.HSDAO_TB_CATALOGO );
            } catch ( Exception ex ) {
                ex.printStackTrace();
            }
        }
        return tbCatalogoDAO;
    }

    public static HSCategoriaDAO getTbCategoriaDAO() {
        if ( tbCategoriaDAO == null ) {
            try {
                tbCategoriaDAO = (HSCategoriaDAO) ServiceFinder.findBean( ConstantesWeb.HSDAO_TB_CATEGORIA );
            } catch ( Exception ex ) {
                ex.printStackTrace();
            }
        }
        return tbCategoriaDAO;
    }

    public static HSClienteDAO getTbClienteDAO() {
        if ( tbClienteDAO == null ) {
            try {
                tbClienteDAO = (HSClienteDAO) ServiceFinder.findBean( ConstantesWeb.HSDAO_TB_CLIENTE );
            } catch ( Exception ex ) {
                ex.printStackTrace();
            }
        }
        return tbClienteDAO;
    }

    public static HSDistritoDAO getTbDistritoDAO() {
        if ( tbDistritoDAO == null ) {
            try {
                tbDistritoDAO = (HSDistritoDAO) ServiceFinder.findBean( ConstantesWeb.HSDAO_TB_DISTRITO );
            } catch ( Exception ex ) {
                ex.printStackTrace();
            }
        }
        return tbDistritoDAO;
    }

    public static HSEmpleadoDAO getTbEmpleadoDAO() {
        if ( tbEmpleadoDAO == null ) {
            try {
                tbEmpleadoDAO = (HSEmpleadoDAO) ServiceFinder.findBean( ConstantesWeb.HSDAO_TB_EMPLEADO );
            } catch ( Exception ex ) {
                ex.printStackTrace();
            }
        }
        return tbEmpleadoDAO;
    }

    public static HSMarcaDAO getTbMarcaDAO() {
        if ( tbMarcaDAO == null ) {
            try {
                tbMarcaDAO = (HSMarcaDAO) ServiceFinder.findBean( ConstantesWeb.HSDAO_TB_MARCA );
            } catch ( Exception ex ) {
                ex.printStackTrace();
            }
        }
        return tbMarcaDAO;
    }

    public static HSMenuDAO getTbMenuDAO() {
        if ( tbMenuDAO == null ) {
            try {
                tbMenuDAO = (HSMenuDAO) ServiceFinder.findBean( ConstantesWeb.HSDAO_TB_MENU );
            } catch ( Exception ex ) {
                ex.printStackTrace();
            }
        }
        return tbMenuDAO;
    }

    public static HSOfertaComboDAO getTbOfertaComboDAO() {
        if ( tbOfertaComboDAO == null ) {
            try {
                tbOfertaComboDAO = (HSOfertaComboDAO) ServiceFinder.findBean( ConstantesWeb.HSDAO_TB_OFERTA_COMBO );
            } catch ( Exception ex ) {
                ex.printStackTrace();
            }
        }
        return tbOfertaComboDAO;
    }

    public static HSOfertaDescuentoDAO getTbOfertaDescuentoDAO() {
        if ( tbOfertaDescuentoDAO == null ) {
            try {
                tbOfertaDescuentoDAO = (HSOfertaDescuentoDAO) ServiceFinder.findBean( ConstantesWeb.HSDAO_TB_OFERTA_DESCUENTO );
            } catch ( Exception ex ) {
                ex.printStackTrace();
            }
        }
        return tbOfertaDescuentoDAO;
    }

    public static HSProductoDAO getTbProductoDAO() {
        if ( tbProductoDAO == null ) {
            try {
                tbProductoDAO = (HSProductoDAO) ServiceFinder.findBean( ConstantesWeb.HSDAO_TB_PRODUCTO );
            } catch ( Exception ex ) {
                ex.printStackTrace();
            }
        }
        return tbProductoDAO;
    }

    public static HSProveedorDAO getTbProveedorDAO() {
        if ( tbProveedorDAO == null ) {
            try {
                tbProveedorDAO = (HSProveedorDAO) ServiceFinder.findBean( ConstantesWeb.HSDAO_TB_PROVEEDOR );
            } catch ( Exception ex ) {
                ex.printStackTrace();
            }
        }
        return tbProveedorDAO;
    }

    public static HSReporteDAO getTBReporteDAO() {
        if ( tbReporteDAO == null ) {
            try {
                tbReporteDAO = (HSReporteDAO) ServiceFinder.findBean( ConstantesWeb.HSDAO_TB_REPORTE );
            } catch ( Exception ex ) {
                ex.printStackTrace();
            }
        }
        return tbReporteDAO;
    }

    public static HSRolDAO getTbRolDAO() {
        if ( tbRolDAO == null ) {
            try {
                tbRolDAO = (HSRolDAO) ServiceFinder.findBean( ConstantesWeb.HSDAO_TB_ROL );
            } catch ( Exception ex ) {
                ex.printStackTrace();
            }
        }
        return tbRolDAO;
    }

    public static HSUsuarioDAO getTbUsuarioDAO() {
        if ( tbUsuarioDAO == null ) {
            try {
                tbUsuarioDAO = (HSUsuarioDAO) ServiceFinder.findBean( ConstantesWeb.HSDAO_TB_USUARIO );
            } catch ( Exception ex ) {
                ex.printStackTrace();
            }
        }
        return tbUsuarioDAO;
    }

    public static HSVentaDAO getTbVentaDAO() {
        if ( tbVentaDAO == null ) {
            try {
                tbVentaDAO = (HSVentaDAO) ServiceFinder.findBean( ConstantesWeb.HSDAO_TB_VENTA );
            } catch ( Exception ex ) {
                ex.printStackTrace();
            }
        }
        return tbVentaDAO;
    }
}
